package org.goldenport.g3.platforms

import com.asamioffice.goldenport.text.UString.notNull
import org.goldenport.session.GSession
import org.goldenport.service.GServiceContext
import org.goldenport.g3._

/**
 * @since   Sep. 22, 2010
 * @version Oct.  5, 2010
 * @author  ASAMI, Tomoharu
 */
class GoldenportPlatform(
  val session: GSession,
  val gcontext: GServiceContext
) extends G3StandalonePlatform {
  val gContext = session.sessionContext

  def logInfo(o: AnyRef, message: Any, data: Any = None) {
    val msg = make_message(o, "", message, data)
    gContext.record_message(msg)
  }

  def logEnter(o: AnyRef, name: String, message: Any, data: Any = None) {
    val msg = make_message(o, name, message, data)
    gContext.record_debug(msg)
  }

  def logLeave(o: AnyRef, name: String, message: Any, data: Any = None) {
    val msg = make_message(o, name, message, data)
    gContext.record_debug(msg)
  }

  def logDebug(o: AnyRef, message: Any, data: Any = None) {
    val msg = make_message(o, "", message, data)
    gContext.record_debug(msg)
  }

  def logInfoData(o: AnyRef, message: Any)(data: => Any) {
    val msg = make_message(o, "", message, data)
    gContext.record_message(msg)
  }

  def logEnterData(o: AnyRef, name: String, message: Any)(data: => Any) {
    val msg = make_message(o, name, message, data)
    gContext.record_debug(msg)
  }

  def logLeaveData(o: AnyRef, name: String, message: Any)(data: => Any) {
    val msg = make_message(o, name, message, data)
    gContext.record_debug(msg)
  }

  def logDebugData(o: AnyRef, message: Any)(data: => Any) {
    val msg = make_message(o, "", message, data)
    gContext.record_debug(msg)
  }
}
